<template>
	<view>
		<view class="uni-padding-wrap uni-common-mt" style="padding-left: 0px; padding-right: 0px;">
			<view class="uni-flex uni-column">
					
				<!--顶部模块 -->
				<view class="bgimage"> 
					<view class="top">
						<view class="search">
							<input class="search-con" type="text" placeholder="请输入设备号" v-model='ssn'>
							<image src="http://yunzhidun.oss-cn-beijing.aliyuncs.com/weixin/static/equipment/search.png" mode="widthFix" class="searchpic" @tap="search(ssn)"></image>
							
						</view>
						<!-- <view class="top-right"  @tap="add_Equip">
							<image src="http://yunzhidun.oss-cn-beijing.aliyuncs.com/weixin/static/equipment/Add.png" mode="widthFix" class="addpic"></image>
							<view class="add-con" style="font-size: 28rpx;">添加设备</view>
						</view> -->
					</view>
				
					<!-- 介绍展示区域 -->
					<!-- <view class="recommend-all"> -->
						<!-- 上方内容布局 -->
						<!-- <view class="uni-flex uni-row">
							<image src="http://yunzhidun.oss-cn-beijing.aliyuncs.com/weixin/static/equipment/banner-0.png" class="recommend-pic" mode="widthFix"></image>
								
						</view>
					</view>
				 -->
				</view>
				
				<view class="shopback">
					
						<view class="equip" :class="isFixed?'pt':'pt1'" id="nav">
							<view class="equip-content">
								
								<view class="choose">
									<view @tap="choosetype(1)">排序<text style="font-size: 16rpx;color: #999999;">▼</text>
									<view :class="active == 1 "></view>
									</view>
									<!-- <view @tap="choosetype(2)">分组<text style="font-size: 16rpx;color: #999999;">▼</text>
									<view :class="active == 2 "></view>
									</view> -->
									<view @tap="choosetype(3)">类型<text style="font-size: 16rpx;color: #999999;">▼</text>
									<view :class="active == 3 "></view>
									</view>
									<view @tap="choosetype(4)">筛选<text style="font-size: 16rpx;color: #999999;">▼</text>
									<view :class="active == 4 "></view>
									</view>
									<!-- <view class="group">
										<view class="group-con" style="font-size: 28rpx;" @tap="goGroup"><image src="http://yunzhidun.oss-cn-beijing.aliyuncs.com/weixin/static/equipment/grouping.png" mode="widthFix" class="grouppic"></image>分组管理</view>
									</view> -->
								</view>
								
							</view>	
							<view class="schoose">
								<view 
									v-for="(item,index1) in items" 
									:key='index1' 
									class="type" 
									@tap="chooseHead(index1)" 
									:class="headIndex == index1 ?'active':''"
									>{{item}}</view>
							</view>
							
						</view>
					<!-- 设备列表 -->
					<view class="equip-list">
						
						
						<view v-for="(item,index1) in list" :key='index1'  class=""  v-if="headIndex != 4">
							<view class="equip-con" @tap="goEquipDetails(item.id,item.status)" v-if="item.type == 2 || item.type == 3 || item.type == 4">
								<view class="equip-pic">
									<image :src="item.img" style="width:160rpx ; height: 160rpx;"></image>
								</view>
								<view class="equip-info">
									<view class="eq1">
										<view class="e-name">{{item.rong.substring(0,6)}}</view>
										<view class="e-type">
											<view v-if="item.type == 2">X86</view>
											<view v-else-if="item.type == 3">TV-BOX</view>
											<view v-else-if="item.type == 4">路由器</view>
											<view v-else>待确认</view>
										</view>
									</view>
									<view class="eq2">
										<view class="e-comp">{{brandName}}</view>
										<view class="e-server">{{item.address}}</view>
										<view class="dot-status">
											<view v-if="item.status ==1" class="dot-green"></view>
											<view v-else-if="item.status == 2" class="dot-grey"></view>
											<view v-else-if="item.status == 0" class="dot-red"></view>
										</view>
									</view>
									<view class="eq3">
										<view class="e-band">{{item.NG}}</view>
										<view class="e-number">{{item.title.substring(item.title.length-12)}}</view>
									</view>
								</view>
								<view class="equip-pro">
									<view class="today-p">+{{item.profit}}</view>
									<view class="total-p">总{{item.total}}</view>
								</view>
								<view>
									<image src="http://yunzhidun.oss-cn-beijing.aliyuncs.com/weixin/static/equipment/arrow.png" mode="widthFix" class="equip-right" ></image>
								</view>
							</view>
							
							<view class="equip-con" @tap="toJiankong(item.id,item.status,item.type,item.rong,item.title)" v-if="item.type == 6 || item.type == 1">
								<view class="equip-pic">
									<image :src="item.img" style="width:160rpx ; height: 160rpx;"></image>
								</view>
								<view class="equip-info">
									<view class="eq1">
										<view class="e-name">{{item.rong.substring(0,6)}}</view>
										<view class="e-type">
											<view v-if="item.type == 1">服务器A</view>
											<view v-else-if="item.type == 6">服务器B</view>
											<view v-else>待确认</view>
										</view>
									</view>
									<view class="eq2">
										<view class="e-comp">{{brandName}}</view>
										<view class="e-server">{{item.address}}</view>
										<view class="dot-status">
											<view v-if="item.status ==1" class="dot-green"></view>
											<view v-else-if="item.status == 2" class="dot-grey"></view>
											<view v-else-if="item.status == 0" class="dot-red"></view>
										</view>
									</view>
									<view class="eq3">
										<view class="e-band">{{item.NG}}</view>
										<view class="e-number">{{item.title.substring(item.title.length-12)}}</view>
									</view>
								</view>
								<view class="equip-pro">
									<view class="today-p">+{{item.profit}}</view>
									<view class="total-p">总{{item.total}}</view>
								</view>
								<view>
									<image src="http://yunzhidun.oss-cn-beijing.aliyuncs.com/weixin/static/equipment/arrow.png" mode="widthFix" class="equip-right" ></image>
								</view>
							</view>
						</view>
						
						
					</view>
					
				</view>
						
				<view class="boxType" v-if="showType"  @tap="conealType"></view>
				
				<view class="modal-type" v-if="showType">
					<view class="choose-type"  v-if="active==4">
						<view class="tit">
							筛选
						</view>
						<view class="contentb">
							<view class="conta">
								<view class="choo" :class="type==1? 'activea': 'titlea'" @tap="queryType(1)">服务器A</view>
								<view class="choo" :class="type==2? 'activea': 'titlea'" @tap="queryType(2)">工控机</view>
							</view>
							<view class="conta">
								<view class="choo" :class="type==3? 'activea': 'titlea'" @tap="queryType(3)">TV-Box</view>
								<view class="choo" :class="type==4? 'activea': 'titlea'" @tap="queryType(4)">路由器</view>
							</view>
							<view class="conta">
								<view class="choo" :class="type==6? 'activea': 'titlea'" @tap="queryType(6)">服务器B</view>
								<view class="choo"></view>
							</view>
						</view>
						<view class="tit">
							运营商
						</view>
						<view class="contenta">
							<view class="choo" :class="isp=='电信'? 'activea': 'titlea'" @tap="queryIsp('电信')">电信</view>
							<view class="choo" :class="isp=='联通'? 'activea': 'titlea'" @tap="queryIsp('联通')">联通</view>
							<view class="choo" :class="isp=='移动'? 'activea': 'titlea'" @tap="queryIsp('移动')">移动</view>
						</view>
						<view class="tit">
							省份
						</view>
						<view class="contenta">
							<view v-for="(item,index3) in pro" :key='index3' :class="province==item.province? 'activea': 'titlea'" @tap="queryPro(item.province)" >{{item.province}}</view>
						</view>
						<view class="btn-group" style="margin-top: 40rpx;">
							<view class="coneal" @tap="conealType">取消</view>
							<view class="submit" @tap="comfimType">确认</view>
						</view>
					</view>
					<view class="choose-type"  v-if="active==3">
						<view class="ctitle" style="font-weight: bold;margin: 10rpx 0;">
							类型
						</view>
						<view class="content">
							<view class="cho" :class="type==1? 'active1': 'title'" @tap="queryType1(1)">服务器A</view>
							<view class="cho" :class="type==2? 'active1': 'title'" @tap="queryType1(2)">工控机</view>
							<view class="cho" :class="type==3? 'active1': 'title'" @tap="queryType1(3)">TV-Box</view>
							<view class="cho" :class="type==4? 'active1': 'title'" @tap="queryType1(4)">路由器</view>
							<view class="cho" :class="type==6? 'active1': 'title'" @tap="queryType1(6)">服务器B</view>
						</view>
					</view>
					<!-- <view class="choose-type"  v-if="active==2">
						<view class="ctitle" style="font-weight: bold;margin: 10rpx 0;">
							分组
						</view>
						<view class="content1">
							<view 
							v-for="(item2,index4) in groupList" 
							:key='index4' 
							:class="groupId==item2.group_id? 'active1': ''" 
							@tap="queryGroup(item2.group_id)" >
							{{item2.group_name}}
							</view>
						</view>
					</view> -->
					<view class="all" v-if="active==1">
						<!-- <view class="line1"></view> -->
						<view :class="order == 0? 'active1':'title'" @tap="chooseOrder(0)">默认排序</view>
						<!-- <view class="line"></view> -->
						<view :class="order == 1? 'active1':'title'" @tap="chooseOrder(1)">昨日收益最高</view>
						<view class="line"></view>
						<view :class="order == 2? 'active1':'title'" @tap="chooseOrder(2)">昨日收益最低</view>
						<view class="line"></view>
						<view :class="order == 3? 'active1':'title'" @tap="chooseOrder(3)">总收益最高</view>
						<view class="line"></view>
						<view :class="order == 4? 'active1':'title'" @tap="chooseOrder(4)">总收益最低</view>
						<view class="line"></view>
					</view>
					
				</view>
				
				<view class="modal-group" v-if="chooseEquip">
					<view class="titles">
						选择添加类型
					</view>
					<view class="uni-list">
						<radio-group @change="radioChange">
							<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in itemms" :key="item.value" >
								<view>
									<radio :value="item.value" :checked="index === current" active-border-color="#ff5500" activeBackgroundColor="#ffffff" color="#ff7708"/>
								</view>
								<view>{{item.name}}</view>
							</label>
						</radio-group>
					</view>
					<view class="btn-group">
						<view class="coneal-group" @tap="coneal">取消</view>
						<view class="submit-group" @tap="comfim">确定</view>
					</view>
				</view>
						
			</view>
			
			<view class="node-box" v-if="nodeShow"  @tap="conealNodeShow"></view>
			<view class="node-modal" v-if="nodeShow">
				<view class="title3">
					请选择
				</view>
				<view class="content3">
					<view>
						<label class="radio" style="margin-left: 150rpx;" @tap="nodechange(1)">
							<radio value="质量报告" :checked="checked == 1" color="#4CD964"/>质量报告
						</label>
					</view>
					<view>
						<label class="radio" style="margin-left: 150rpx;" @tap="nodechange(2)">
							<radio value="节点详情" :checked="checked == 2" color="#4CD964"/>节点详情
						</label>
					</view>
					<view>
						<label class="radio" style="margin-left: 150rpx;" @tap="nodechange(3)">
							<radio value="网络信息" :checked="checked == 3" color="#4CD964"/>网络信息
						</label>
					</view>
				</view>
				<view class="btn-group3">
					<view class="coneal" @tap="conealNodeShow">取消</view>
					<view class="submit" @tap="comfimNodeShow">确认</view>
				</view>
			</view>
			
			<!-- 派享进入页面代码 -->
			
			<view class="node-box" v-if="paishow"  @tap="conealpaiShow"></view>
			<view class="node-modal" v-if="paishow">
				<view class="title3">
					请选择
				</view>
				<view class="content3">
					<view>
						<label class="radio" style="margin-left: 150rpx;" @tap="paichange(1)">
							<radio value="质量报告" :checked="paichecked == 1" color="#4CD964"/>质量报告
						</label>
					</view>
					<view>
						<label class="radio" style="margin-left: 150rpx;" @tap="paichange(2)">
							<radio value="节点详情" :checked="paichecked == 2" color="#4CD964"/>节点详情
						</label>
					</view>
					<view>
						<label class="radio" style="margin-left: 150rpx;" @tap="paichange(3)">
							<radio value="网络信息" :checked="paichecked == 3" color="#4CD964"/>网络信息
						</label>
					</view>
				</view>
				<view class="btn-group3">
					<view class="coneal" @tap="conealpaiShow">取消</view>
					<view class="submit" @tap="comfimpaiShow">确认</view>
				</view>
			</view>
			
		</view>	
	</view>
</template>

<script>
	let App = getApp()
	
	export default {
		data() {
			return {
				items: ['全部', '在线','离线', '异常'],
				current: 0,
				list:[],
				status:4,
				newRemark:'',
				show:false,
				clickId:'',
				active:1,
				showType:false,
				showGroup:false,
				cri:false,
				submitBtn:true,
				delBtn:true,
				groupName:'',
				groupList:[],
				dalArray:[],
				order:0,
				pro:[],//省
				type:0,
				isp:0,
				province:'',
				groupId:0,
				updateshow:false,
				updateName:'',
				updateId:0,
				page:1,
				brandName:'云支点',
				headIndex:0,
				SN:'',
				itemms: [{
						value: 'smallCode',
						name: '小节点'
					},
					{
						value: 'bigCodeA',
						name: '大节点A',
						// checked: 'true'
					},
					{
						value: 'bigCodeB',
						name: '大节点B'
					},
				],
				ssn:'',
				isFixed:false,//是否吸顶
				topfixed:0,
				
				nodeShow:false,
				checked:1,
				selectID:'',
				equ_status:0,
				paishow:false,
				paichecked:1,
				natinfo:[],
				natnames:''
			}
		},
		onReady() {
			
		},
		onPageScroll(e){
			let scrollTop = parseInt(e.scrollTop),
			isFixed = !isFixed
		},
		onLoad() {
			// this.status = uni.getStorageSync('equValue');
			// this.headIndex = uni.getStorageSync('equIndex')*1;
			
			setTimeout(function () {
				console.log('start pulldown');
			}, 1000);
			uni.startPullDownRefresh();
		},
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
			this.getlist();
		},
		onUnload() {
			this.newRemark = ''
			this.show = false
		},
		onShow(option) {
			this.page=1
			this.status = uni.getStorageSync('equValue');
			this.headIndex = uni.getStorageSync('equIndex')*1;
			this.ssn=''
			this.brandName = App.globalData.name
			this.getGroupList();
			this.showType = false;
			this.getlist();	
		},
		// uni.addEventListener('scroll', function() {
		//   var topElement = document.querySelector('.top-element');
		//   var scrollPosition = uni.pageYOffset || document.documentElement.scrollTop;
		
		//   if (scrollPosition > 200) { // 当滚动位置超过200px时
		//     topElement.classList.add('fixed');
		//   } else {
		//     topElement.classList.remove('fixed');
		//   }
		// }),
		//监听页面滚动
		// onPageScroll:function(e){
		// 	console.log(e);
		// 	this.setData({
		// 		scrollTop: e.scrollTop
		//     })
		//   },
		methods: {
			//导航选项方法
			chooseHead(index){
				
				uni.pageScrollTo({
				    scrollTop: 0,
				    duration: 100,
				});
				
				this.headIndex = index
				this.page = 1
				let userinfo = uni.getStorageSync('userinfo');
				uni.showLoading({
					title:"加载中"
				})
				let object = {'user_id':userinfo.id,'search':this.ssn,};
				
				if(index == 1){
					object.status = 1
					this.status = 1
				}else if(index == 2){
					object.status = 2
					this.status = 2
				}else if(index == 3){
					object.status = 3
					this.status = 3
				}else if(index == 0){
					object.status = 4
					this.status = 4
				}
				// else if(index == 4){
				// 	// uni.hideLoading()
				// 	return;
				// }
				
				this.$api.interfaceApi('equipmentList')(
					object
				).then(res=>{
					this.list = res.data
					uni.setStorageSync('equValue',this.status);
					uni.setStorageSync('equIndex',index);
					uni.hideLoading()
				})
				
			},
			// 加载设备数据
			onReachBottom() {
				// 设备搜索
				if(this.ssn!=''){
					return;
				}
				this.page = this.page+1;
				let userinfo = uni.getStorageSync('userinfo');
				uni.showLoading({
					title:"加载中"
				})
				this.$api.interfaceApi('equipmentList')({
					'user_id':userinfo.id,
					'status':this.status,
					'page':this.page,
					'search':this.ssn,
				}).then(res=>{
					uni.hideLoading()
					if(res.data.length == 0){
						uni.showToast({
							icon:'error',
							title:'已经没有数据了哦'
						})
						this.page = this.page-1
					}
					this.list = this.list.concat(res.data)
				})
				
			},
			
			//获取设备列表
			getlist(){
				let userinfo = uni.getStorageSync('userinfo');
				uni.showLoading({
					title:"加载中"
				})
				this.$api.interfaceApi('equipmentList')({
					'user_id':userinfo.id,
					'status':this.status,
					"page":this.page,
					'search':this.ssn,
				}).then(res=>{
					uni.hideLoading()
					if(res.data){
						this.list = res.data
						// console.log(this.list)
					}
				})
			},
			
			onClickItem(val) {
			    this.current = val.currentIndex
			},
			
			//添加设备
			add_Equip(){
				
				let _this = this;
				let userinfo = uni.getStorageSync('userinfo');
				uni.scanCode({
				    success: function (res) {
						_this.SN = res.result
						_this.sn = res.result
						_this.chooseEquip = true;	
				    }
				});
			},
			coneal(){
				this.chooseEquip = false
			},
			comfim(){
				
				let userinfo = uni.getStorageSync('userinfo');
				this.$api.interfaceApi('add')({
					'sn':this.sn,
					"id":userinfo.id,
					'admin_id':App.globalData.sys,
					'type':this.type
				}).then(res=>{
					console.log(res)
					this.show = false
					uni.showToast({
						title:res.msg,
						icon:"none"
					})
				});
				// console.log(this.sn,this.current)
			},
			change(num){
				if(num == 2){
					this.checked = 2
					this.type = 2
				}else if(num == 3){
					this.checked = 3
					this.type = 3
				}else if(num == 4){
					this.checked = 4
					this.type = 4
				}
			},
			radioChange(evt) {
				for (let i = 2; i < this.items.length; i++) {
					if (this.items[i].value === evt.detail.value) {
						this.current = i;
						break;
					}
				}
			},
			
			goEquipDetails(id,status){
				if(status == 0){
					uni.navigateTo({
						url:`/pages/equipment/scan?id=${id}`
					})
				}else{
					uni.navigateTo({
						url:`/pages/equipment/eqDetails?id=${id}`
					})
				}
			},
			//跳转到分组
			goGroup(){
				uni.navigateTo({
					url:("/pages/equipment/group")
				})
			},
			scollSwiper(e){
				let userinfo = uni.getStorageSync('userinfo');
				
				
				uni.showLoading({
					title:"加载中"
				})
			    this.current = e.target.current
				let object = {'user_id':userinfo.id,'search':this.ssn,};
				
				if(e.target.current == 1){
					object.status = 1
					this.status = 1
				}else if(e.target.current == 2){
					object.status = 2
					this.status = 2
				}else if(e.target.current == 3){
					object.status = 3
					this.status = 3
				}else if(e.target.current == 0){
					object.status = 4
					this.status = 4
				}else if(e.target.current == 4){
					uni.hideLoading()
					return;
				}
				
				this.$api.interfaceApi('equipmentList')(object).then(res=>{
					this.list = res.data
					uni.setStorageSync('equValue',this.status);
					uni.setStorageSync('equIndex',e.target.current);
					uni.hideLoading()
				})
			},
			
			getGroupList(){
				let userinfo = uni.getStorageSync('userinfo');
				this.$api.interfaceApi('getGroup')({
					uid:userinfo.id
				}).then(res=>{
					this.groupList = res.data
				})
			},
			toLog(id,status){
				if(status == 0){
					uni.navigateTo({
						url:`/pages/equipment/scan?id=${id}`
					})
				}else{
					uni.navigateTo({
						url:`/pages/equipment/log?id=${id}`
					})
				}
			},
			updateRemark(id,remark){
				this.clickId = id;
				this.show = true
				this.newRemark = remark
			},
			
			comfim(){
				if(this.newRemark == ''){
					uni.showToast({
						title:"名称不能为空",
						icon:"none"
					})
					return
				}
				this.$api.interfaceApi('updateRemark')({
					'id':this.clickId,
					'remark':this.newRemark
				}).then(res=>{
					uni.showToast({
						title:res.msg,
						icon:"none"
					})
					if(res.code == 1){
						this.getlist();	
						this.newRemark = ''
						this.show = false
					}
				})
			},
			coneal(){
				this.newRemark = ''
				this.show = false
			},
			conealType(){
				this.showType = false
				document.documentElement.style.overflowY='auto'
			},
			//查找
			comfimType(){
				let userinfo = uni.getStorageSync('userinfo');
				uni.showLoading({
					title:"加载中"
				})
				let Object = {
					'user_id':userinfo.id,
					'status':this.status,
					'search':this.ssn,
				}
				
				if(this.active == 1){
					Object.order = this.order
				}else if(this.active == 4){
					
					Object.type = this.type
					Object.isp = this.isp
					Object.province = this.province
				}else if(this.active == 3){
					Object.type = this.type
				}else if(this.active == 2){
					Object.gid=this.groupId
				}
				
				this.$api.interfaceApi('equipmentList')(Object).then(res=>{
					this.list = res.data
					this.showType = false
					uni.hideLoading()
				})
			},
			
			choosetype(index){
				this.type = 0
				this.showType = true
				this.province = ''
				this.isp = ''
				this.active = index
				document.documentElement.style.overflowY='hidden'
			},
			conealGroup(){
				this.showGroup = false
			},
			comfimGroup(){
				let userinfo = uni.getStorageSync('userinfo');
				this.$api.interfaceApi('addGroup')({
					'uid':userinfo.id,
					'name':this.groupName
				}).then(res=>{
					uni.showToast({
						title:res.msg,
						icon:"none"
					})
					if(res.code == 1){
						//此处应该要刷新一个列表
						this.showGroup = false
						this.getGroupList()
					}
				})
			},
			addGroup(){
				this.showGroup = true
			},
			delGroup(){
				this.cri = true
				this.submitBtn = false
				this.delBtn = false
			},
			//取消删除
			conealDel(){
				this.cri = false
				this.submitBtn = true
				this.delBtn = true
			},
			//点击选择删除分组
			delArr(id){
				if(this.dalArray.indexOf(id) >= 0){
					this.dalArray.splice(this.dalArray.indexOf(id),1);
				}else{
					this.dalArray.push(id);
				}
				console.log(this.dalArray)
			},
			//确定删除
			comDel(){
				let userinfo = uni.getStorageSync('userinfo');
				this.$api.interfaceApi('delGroup')({
					group:this.dalArray,
					uid:userinfo.id
				}).then(res=>{
					uni.showToast({
						title:res.msg,
						icon:"none"
					})
					this.getGroupList()
				})
			},
			
			chooseOrder(index){
				this.page = 1
				if(this.order == index){
					this.order = ''
				}else{
					this.order = index
				}
				this.comfimType()
			},
			queryType(index){
				if(this.type == index){
					this.type = ''
				}else{
					this.type = index
				}
			},
			queryType1(index){
				if(this.type == index){
					this.type = 0
				}else{
					this.type = index
				}
				this.comfimType()
			},
			queryIsp(index){
				if(this.isp == index){
					this.isp = 0
				}else{
					this.isp = index
				}
			},
			queryPro(prov){
				if(this.province == prov){
					this.province = ''
				}else{
					this.province = prov
				}
			},
			queryGroup(index){
				if(this.groupId == index){
					this.groupId = 0
				}else{
					this.groupId = index
				}
				this.comfimType()
			},
			updateGroup(gid,name){
				this.updateshow = true
				this.updateName = name
				this.updateId = gid
			},
			
			conealUpdate(){
				this.updateshow = false
			},
			comfimUpdate(){
				this.$api.interfaceApi('updateGroup')({
					gid:this.updateId,
					name:this.updateName
				}).then(res=>{
					this.updateshow = false
					uni.showToast({
						title:res.msg,
						icon:"none"
					})
					this.getGroupList()
				})
			},
			
			search(sn){
				uni.showLoading({
					title:"加载中"
				})
				let userinfo = uni.getStorageSync('userinfo')
				this.$api.interfaceApi('equipmentList')({
					'user_id':userinfo.id,
					'status':this.status,
					"page":this.page,
					'search':this.ssn,
				}).then(res=>{
					uni.hideLoading()
					if(res.data.length>0){
						this.list = res.data
						console.log(this.list)
					}else{
						uni.showToast({
							title:'设备号未找到',
							icon:"error"
						})
					}
				})
			},
			
			//跳转监控
			toJiankong(id,status,type,remarks,title){
				if(type == 1){//犀牛
					this.selectID = id
					this.nodeShow = true
					this.equ_status = status
				}else if(type == 6){//派享
					//console.log(title)
					this.paishow = true
					this.selectID = title
					this.equ_status = status
				}else{
					uni.navigateTo({
						url:`/pages/equipment/jiankong?id=${id}&remarks=${remarks}`
					})
				}
				
			},
			
			
			//派享代码区域分割区
			//派享跳转关闭
			conealpaiShow(){
				this.paishow = false
			},
			
			//派享跳转页面代码
			paichange(num){
				this.paichecked = num
				this.getnatNodeInfo()
			},
			
			//派享对应的页面跳转
			comfimpaiShow(){
				if(this.paichecked == 1){
					uni.navigateTo({
						url:'/pages/equipment/pai-quality-report?selectID='+this.selectID+'&status='+this.equ_status
					})
				}else if(this.paichecked == 2){
					uni.navigateTo({
						url:'/pages/equipment/pai-node-info?selectID='+this.selectID+'&status='+this.equ_status
					})
				}else if(this.paichecked == 3){
					console.log(this.selectID)
					if(this.natnames==''){
						uni.navigateTo({
							url:'/pages/index/nats-config?nodeID='+this.selectID
						})
					}else{
						uni.navigateTo({
							url:'/pages/equipment/pai-nat-info?selectID='+this.selectID
						})
					}
				}
				this.paishow = false
			},
			
			//派享分割区
			
			nodechange(num){
				this.checked = num
				this.getnatNodeInfo()
			},
			conealNodeShow(){
				this.nodeShow = false
			},
			comfimNodeShow(){
				if(this.checked == 1){
					uni.navigateTo({
						url:'/pages/equipment/quality-report?selectID='+this.selectID+'&status='+this.equ_status
					})
				}else if(this.checked == 2){
					uni.navigateTo({
						url:'/pages/equipment/node-info?selectID='+this.selectID+'&status='+this.equ_status
					})
				}else if(this.checked == 3){
					uni.navigateTo({
						url:'/pages/equipment/nat-info?selectID='+this.selectID
					})
				}
			this.nodeShow = false
			},
			
			//派享网络报告
			getnatNodeInfo(){
				let userinfo = uni.getStorageSync('userinfo');
				this.$api.interfaceApi('getnatNodeInfo')({
					nodeId:this.selectID,
					//sys:App.globalData.sy
				}).then(res=>{
					this.natinfo = res
					this.natnames = res.name
					
				})
			},
			
		}
	}
</script>

<style>
@import url("equipment.css");
@import url("../../common/uni.css");
</style>
